<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8">
        <title>服务-家政护理 编辑页面</title>
        <meta content='width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no' name='viewport'>
        <jsp:include page="../com/header.jsp"></jsp:include>
        <script type="text/javascript" src="../../js/comm/editcomm.js"></script>
        
        <script type="text/javascript">
		$(function(){
			//getDataById(root + 'cms/domesticNursing/findDomesticNursingById',"#domesticNursingTmpl","#domesticNursingContent");
			$("#saveOrupdate").click(function(){
				$("#nurse_PicUrl").val(imgUrl);
				if (!$('#domesticNursingContent').find('#myImageShow').attr('src')) {
					myAlert("请上传图片");
					return;
				}
				saveData(root + 'cms/domesticNursing/saveDomesticNursing','domesticNursingList.jsp');
			});
			
			var tId = getUrlParam("id");
			if (!tId) {
				myAlert('id参数不能为空');
				return;
			}
			$.ajax({
				url : root + 'cms/domesticNursing/findDomesticNursingById',
				type : 'post',
				dataType : 'json',
				data : {
					modelId : tId
				},
				success : function(data) {
					
					console.log(data);
					if (data.code == 1) {
						
						
						var contentHtml = $('#domesticNursingTmpl').render(
								data.object, {
									mydata : data
								});
						$('#domesticNursingContent').html(contentHtml);
						ue = UE.getEditor("nurse_Inforation");
						ue.addListener("ready", function() {
							if (data.object.nurse_Inforation)
								ue.setContent(data.object.nurse_Inforation);
						});
						
						$("#nurse_Age").datetimepicker({format: 'yyyy-mm',startView: 'decade',minView: 'month',language : 'zh-CN',autoclose: true}).on('changeDate',function(ev){
		            		var starttime=$("#nurse_Age").val();
		            		$("#nurse_Age").datetimepicker('hide');
		            	});
						$("#nurse_LengthServi").datetimepicker({format: 'yyyy',startView: 'decade',minView: 'decade',language : 'zh-CN',autoclose: true}).on('changeDate',function(ev){
		            		var starttime=$("#nurse_LengthServi").val();
		            		$("#nurse_LengthServi").datetimepicker('hide');
		            	});
						
					} else {
						var contentHtml = $('#domesticNursingTmpl').render("");
						$('#domesticNursingContent').html(contentHtml);
					}
				}
			});
			//上传图片
			$('#domesticNursingContent').on('click','#uploadPhotoFile', function () {
				upload("domesticNursing");
	        });
		});
        </script>
    </head>
    <body>
      <section>
          <div>
              <div class="col-xs-12">
                  <div class="box" style="height:900px">
                      <div class="box-header">
                      <br>
                          <input type="button" value="确定" id="saveOrupdate" class="btn btn-success">
                          <input type="button" onclick="backAction('domesticNursingList.jsp');" class="btn btn-info" value="返回"/>
                      </div>
                     <form id="submit_form" class="form-horizontal">
                        <div class="tab" id="domesticNursingContent">
                  	    </div>
                  	 </form>
              </div>
          </div>
      </section>
      <script type="text/x-jsrender" id="domesticNursingTmpl">
			<fieldset> 
				<input type="hidden" id="tId" name="id" value="{{:id}}" />
	        	{{!--<div class="form-group">
        			<label class="col-md-2 control-label controls" for="formGroupInputSmall">图片：</label>
       				 <div class="col-md-3">
						<div class="upload_div">
                        	<img id="myImageShow" src="../../{{:imgUrl}}" width="100px" height="100px" />
                        	<input type="hidden" id="imgUrl" name="imgUrl" value="{{:imgUrl}}"/>
                        	<input type="file" id="uploadPhotoFile" name="photoFile" class="upload_file">
                        </div>
					</div>
      			</div>--}}
				<div class="form-group">
        			<label class="col-md-2 control-label controls" for="formGroupInputSmall">护理人员：</label>
       				 <div class="col-md-3">
						<input type="text" placeholder="请填写护理人员姓名" class="form-control input-sm" data-rule="required;length[0~50]" id="nurse_Name" name="nurse_Name" value="{{:nurse_Name}}" />
					</div>
        			<label class="col-md-2 control-label controls" for="formGroupInputSmall">护理岗位：</label>
       				 <div class="col-md-3">
						<input type="text" placeholder="请填写护理岗位" class="form-control input-sm" data-rule="required;length[0~50]" id="nurse_RoleID" name="nurse_RoleID" value="{{:nurse_RoleID}}" />
					</div>
      			</div>
				<div class="form-group">
        			<label class="col-md-2 control-label controls" for="formGroupInputSmall">性别：</label>
       				 <div class="col-md-3">
						<!--<input type="text" placeholder="请填写人员性别（1:男 2：女）" class="form-control input-sm" data-rule="required;length[0~50]" id="nurse_Sex" name="nurse_Sex" value="{{:nurse_Sex}}" />-->
						<select class="form-control input-sm" id="nurse_Sex" name="nurse_Sex">
									    {{if nurse_Sex==1}}
											<option value="1">男</option>
											<option value="2">女</option>
										{{else}}
             								<option value="2">女</option>
             								<option value="1">男</option>
         							    {{/if}}	
						</select>
					</div>
        			<label class="col-md-2 control-label controls" for="formGroupInputSmall">学校：</label>
       				 <div class="col-md-3">
						<input type="text" placeholder="请填写学校" class="form-control input-sm" data-rule="required;length[0~100]" id="nurse_Education" name="nurse_Education" value="{{:nurse_Education}}" />
					</div>
      			</div>
				<div class="form-group">
        			<label class="col-md-2 control-label controls" for="formGroupInputSmall">护工年龄：</label>
       				 <div class="col-md-3">
						<input type="text" placeholder="出生年月" class="form-control input-sm" data-rule="required;length[0~50]" id="nurse_Age" name="nurse_Age" value="{{:nurse_Age}}" />
					</div>
        			<label class="col-md-2 control-label controls" for="formGroupInputSmall">护工工龄：</label>
       				 <div class="col-md-3">
						<input type="text" placeholder="开始工作时间（年）" class="form-control input-sm" data-rule="required;length[0~50]" id="nurse_LengthServi" name="nurse_LengthServi" value="{{:nurse_LengthServi}}" />
					</div>
      			</div>
				<div class="form-group">
        			<label class="col-md-2 control-label controls" for="formGroupInputSmall">籍贯：</label>
       				 <div class="col-md-3">
						<input type="text" placeholder="籍贯" class="form-control input-sm" data-rule="required;length[0~255]" id="nurse_Native" name="nurse_Native" value="{{:nurse_Native}}" />
					</div>
        			<label class="col-md-2 control-label controls" for="formGroupInputSmall">工资：</label>
       				 <div class="col-md-3">
						<input type="text" placeholder="请填写工资" class="form-control input-sm" data-rule="required;length[0~50];money" id="nurse_Salary" name="nurse_Salary" value="{{:nurse_Salary}}" />
					</div>
      			</div>
				<div class="form-group">
        			<label class="col-md-2 control-label controls" for="formGroupInputSmall">手机号码：</label>
       				 <div class="col-md-3">
						<input type="text" placeholder="请填写手机号码" class="form-control input-sm" data-rule="required;length[0~50];mobile" id="nurse_Cellphone" name="nurse_Cellphone" value="{{:nurse_Cellphone}}" />
					</div>
        			<label class="col-md-2 control-label controls" for="formGroupInputSmall">工资单位：</label>
       				 <div class="col-md-3">
						<!--<input type="text" placeholder="请填写工资单位(年、月、天、次)" class="form-control input-sm" data-rule="required;length[0~50]" id="nurse_Salary_unit" name="nurse_Salary_unit" value="{{:nurse_Salary_unit}}" />-->
						<select class="form-control input-sm" id="nurse_Salary_unit" name="nurse_Salary_unit">
								{{if nurse_Salary_unit=="月"}}
									<option value="月">月</option>
									<option value="年">年</option>
									<option value="天">天</option>
									<option value="次">次</option>
								{{else nurse_Salary_unit=="年"}}
									<option value="年">年</option>
             						<option value="月">月</option>
									<option value="天">天</option>
									<option value="次">次</option>
								{{else nurse_Salary_unit=="年"}}
									<option value="天">天</option>
									<option value="年">年</option>
             						<option value="月">月</option>
									<option value="次">次</option>
								{{else }}
									<option value="次">次</option>
									<option value="年">年</option>
             						<option value="月">月</option>
									<option value="天">天</option>
          						{{/if}}
								
						</select>
					</div>
      			</div>
				<div class="form-group">
        			<label class="col-md-2 control-label controls" for="formGroupInputSmall">排序值：</label>
       				 <div class="col-md-4">
						<input type="text" placeholder="请填写排序值" class="form-control input-sm" data-rule="length[1~10];plus" maxlength="10" id="sort" name="sort" value="{{:sort}}" />
					</div>
      			</div>
				<div class="form-group">
        			<label class="col-md-2 control-label controls" for="formGroupInputSmall">头像照片：</label>
       				 <div class="col-md-3">
						<div class="upload_div">
						<!--<input type="text" placeholder="请填写头像照片（单张）" class="form-control input-sm" data-rule="required;length[0~200]" id="nurse_PicUrl" name="nurse_PicUrl" value="{{:nurse_PicUrl}}" />-->
							<img id="myImageShow" src="../../{{:nurse_PicUrl}}" width="100px" height="100px" />
                        	<input type="hidden" id="nurse_PicUrl" name="nurse_PicUrl" value="{{:nurse_PicUrl}}"/>
                        	<input type="file" id="uploadPhotoFile" name="photoFile" class="upload_file">
						</div>
					</div>
      			</div>
				<div class="form-group">
        			<label class="col-md-2 control-label controls" for="formGroupInputSmall">护工介绍：</label>
       				 <div class="col-md-3">
						<!--<input type="text" placeholder="请填写护工介绍（富文本）" class="form-control input-sm" data-rule="required;length[0~1000]" id="nurse_Inforation" name="nurse_Inforation" value="{{:nurse_Inforation}}" />-->
						<div  id="nurse_Inforation" name="nurse_Inforation" style="height:200px;width:760px;"></div>
					</div>
      			</div>
				
			</fieldset>
	</script>
    </body>
</html>